﻿using System;
using System.Linq;
using System.IO;

namespace _01.DisplayFilesMatchingMask
{
    class DisplayFilesMatchingMask
    {
        static void Traverse(string path)
        {
            string[] directories = Directory.GetDirectories(path);
            string[] files = Directory.GetFiles(path,"*.exe");

            Print(files);
            
            foreach (var directory in directories)
            {
                if (directory != @"C:\System Volume Information")
                {
                    Traverse(directory);
                }
            }
        }

        static void Print(string[] collection)
        {
            foreach (var item in collection)
            {
                Console.WriteLine(item);
            }
        }

        static void Main(string[] args)
        {
            string startDirectory = @"C:\WINDOWS";

            Traverse(startDirectory);
        }
    }
}
